from bcat.rpc.server.services.common_service import CommonService
from jsonrpcserver import Result, Success, Error

class CommonServiceWrapper(object):
    def __init__(self):
        self.__service = CommonService()

    def service(self):
        return self.__service

    def tick(self) -> Result:
        ret = self.service().tick()
        if ret is not None:
            return Success(ret)
        return Error(-1, "got tick error")

    def exit(self) -> Result:
        ret = self.service().exit()
        if ret is not None:
            return Success(ret)
        return Error(-1, "got exit error")


